﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using AnesSystem.Models;

namespace AnesSystem.Controls
{
    /// <summary>
    /// DrawDrugLineCtrl.xaml 的交互逻辑
    /// </summary>
    public partial class DrugLineEnumCtrl : UserControl
    {

        private int _currentPage = 1;


        public DrugLineEnumCtrl()
        {
            InitializeComponent();
            this.Loaded += DrugLineEnumCtrl_Loaded;
        }


        private void DrugLineEnumCtrl_Loaded(object sender, RoutedEventArgs e)
        {

        }

        #region Variables

        #endregion

        #region Constructor

        #endregion

        #region Properties

        public int CurrentPage
        {
            get
            {
                return _currentPage;
            }

            set
            {
                _currentPage = value;
            }
        }

        public BaseDrugLineItemCtrl CurrentLine
        {
            get; set;
        }

        #endregion

        #region 依赖属性


        public Brush StrokeColor
        {
            get { return (Brush)GetValue(StrokeColorProperty); }
            set { SetValue(StrokeColorProperty, value); }
        }
        // Using a DependencyProperty as the backing store for MyProperty.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty StrokeColorProperty =
            DependencyProperty.Register("StrokeColor", typeof(Brush), typeof(BaseDrugLineItemCtrl), new PropertyMetadata(Brushes.Red));


        #endregion

        #region Event

        #endregion

        #region Private Methods

        #endregion

        #region Public/Protected Methods

        public void Display(DrawDrugLineModel lineEnum, PatientDrugsModel pdm, DrugSpeedModel dsm, DrugSpeedModel dsm2)
        {
            BaseDrugLineItemCtrl ctrl = null;
            if (lineEnum == DrawDrugLineModel.VerticalArrowLine)
            {
                ctrl = _arrowRedLine;
                //ctrl.MyStroke = Brushes.Red;
                _arrowRedLine.Visibility = Visibility.Visible;
                _verticalBlackLine.Visibility = Visibility.Collapsed;
                _verticalBlackObliqueLine.Visibility = Visibility.Collapsed;
                _verticalRedLine.Visibility = Visibility.Collapsed;
                _verticalRedTwoLine.Visibility = Visibility.Collapsed;

            }
            else if (lineEnum == DrawDrugLineModel.VerticalBlackLine)
            {
                ctrl = _verticalBlackLine;
                //ctrl.MyStroke = Brushes.Black;
                _arrowRedLine.Visibility = Visibility.Collapsed;
                _verticalBlackLine.Visibility = Visibility.Visible;
                _verticalBlackObliqueLine.Visibility = Visibility.Collapsed;
                _verticalRedLine.Visibility = Visibility.Collapsed;
                _verticalRedTwoLine.Visibility = Visibility.Collapsed;
                _verticalBlackLineNoRight.Visibility = Visibility.Collapsed;
            }
            else if (lineEnum == DrawDrugLineModel.VerticalBlackObliqueLine)
            {
                ctrl = _verticalBlackObliqueLine;
                //ctrl.MyStroke = Brushes.Black;
                _arrowRedLine.Visibility = Visibility.Collapsed;
                _verticalBlackLine.Visibility = Visibility.Collapsed;
                _verticalBlackObliqueLine.Visibility = Visibility.Visible;
                _verticalRedLine.Visibility = Visibility.Collapsed;
                _verticalRedTwoLine.Visibility = Visibility.Collapsed;
            }
            else if (lineEnum == DrawDrugLineModel.VerticalLine)
            {
                ctrl = _verticalRedLine;
                //ctrl.MyStroke = Brushes.Red;
                _arrowRedLine.Visibility = Visibility.Collapsed;
                _verticalBlackLine.Visibility = Visibility.Collapsed;
                _verticalBlackObliqueLine.Visibility = Visibility.Collapsed;
                _verticalRedLine.Visibility = Visibility.Visible;
                _verticalRedTwoLine.Visibility = Visibility.Collapsed;
                _verticalBlackLineNoRight.Visibility = Visibility.Collapsed;
            }
            else if (lineEnum == DrawDrugLineModel.VerticalTwoLine)
            {
                ctrl = _verticalRedTwoLine;
                //ctrl.MyStroke = Brushes.Red;
                _arrowRedLine.Visibility = Visibility.Collapsed;
                _verticalBlackLine.Visibility = Visibility.Collapsed;
                _verticalBlackObliqueLine.Visibility = Visibility.Collapsed;
                _verticalRedLine.Visibility = Visibility.Collapsed;
                _verticalRedTwoLine.Visibility = Visibility.Visible;
                _verticalBlackLineNoRight.Visibility = Visibility.Collapsed;
            }
            else if (lineEnum == DrawDrugLineModel.VerticalBlackLineNoRight)
            {
                ctrl = _verticalBlackLineNoRight;
                //ctrl.MyStroke = Brushes.Black;
                _arrowRedLine.Visibility = Visibility.Collapsed;
                _verticalBlackLine.Visibility = Visibility.Collapsed;
                _verticalBlackObliqueLine.Visibility = Visibility.Collapsed;
                _verticalRedLine.Visibility = Visibility.Collapsed;
                _verticalRedTwoLine.Visibility = Visibility.Collapsed;
                _verticalBlackLineNoRight.Visibility = Visibility.Visible;
            }

            ctrl.MyStroke = StrokeColor;
            ctrl.CurrentPage = CurrentPage;
            ctrl.Initial(pdm, dsm, dsm2);
            CurrentLine = ctrl;
        }

        public void PacuDisplay(DrawDrugLineModel lineEnum, PatientDrugsModel pdm, DrugSpeedModel dsm, DrugSpeedModel dsm2)
        {
            BaseDrugLineItemCtrl ctrl = null;
            if (lineEnum == DrawDrugLineModel.VerticalArrowLine)
            {
                ctrl = _arrowRedLine;
                //ctrl.MyStroke = Brushes.Red;
                _arrowRedLine.Visibility = Visibility.Visible;
                _verticalBlackLine.Visibility = Visibility.Collapsed;
                _verticalBlackObliqueLine.Visibility = Visibility.Collapsed;
                _verticalRedLine.Visibility = Visibility.Collapsed;
                _verticalRedTwoLine.Visibility = Visibility.Collapsed;

            }
            else if (lineEnum == DrawDrugLineModel.VerticalBlackLine)
            {
                ctrl = _verticalBlackLine;
                //ctrl.MyStroke = Brushes.Black;
                _arrowRedLine.Visibility = Visibility.Collapsed;
                _verticalBlackLine.Visibility = Visibility.Visible;
                _verticalBlackObliqueLine.Visibility = Visibility.Collapsed;
                _verticalRedLine.Visibility = Visibility.Collapsed;
                _verticalRedTwoLine.Visibility = Visibility.Collapsed;
                _verticalBlackLineNoRight.Visibility = Visibility.Collapsed;
            }
            else if (lineEnum == DrawDrugLineModel.VerticalBlackObliqueLine)
            {
                ctrl = _verticalBlackObliqueLine;
                //ctrl.MyStroke = Brushes.Black;
                _arrowRedLine.Visibility = Visibility.Collapsed;
                _verticalBlackLine.Visibility = Visibility.Collapsed;
                _verticalBlackObliqueLine.Visibility = Visibility.Visible;
                _verticalRedLine.Visibility = Visibility.Collapsed;
                _verticalRedTwoLine.Visibility = Visibility.Collapsed;
            }
            else if (lineEnum == DrawDrugLineModel.VerticalLine)
            {
                ctrl = _verticalRedLine;
                //ctrl.MyStroke = Brushes.Red;
                _arrowRedLine.Visibility = Visibility.Collapsed;
                _verticalBlackLine.Visibility = Visibility.Collapsed;
                _verticalBlackObliqueLine.Visibility = Visibility.Collapsed;
                _verticalRedLine.Visibility = Visibility.Visible;
                _verticalRedTwoLine.Visibility = Visibility.Collapsed;
                _verticalBlackLineNoRight.Visibility = Visibility.Collapsed;
            }
            else if (lineEnum == DrawDrugLineModel.VerticalTwoLine)
            {
                ctrl = _verticalRedTwoLine;
                //ctrl.MyStroke = Brushes.Red;
                _arrowRedLine.Visibility = Visibility.Collapsed;
                _verticalBlackLine.Visibility = Visibility.Collapsed;
                _verticalBlackObliqueLine.Visibility = Visibility.Collapsed;
                _verticalRedLine.Visibility = Visibility.Collapsed;
                _verticalRedTwoLine.Visibility = Visibility.Visible;
                _verticalBlackLineNoRight.Visibility = Visibility.Collapsed;
            }
            else if (lineEnum == DrawDrugLineModel.VerticalBlackLineNoRight)
            {
                ctrl = _verticalBlackLineNoRight;
                //ctrl.MyStroke = Brushes.Black;
                _arrowRedLine.Visibility = Visibility.Collapsed;
                _verticalBlackLine.Visibility = Visibility.Collapsed;
                _verticalBlackObliqueLine.Visibility = Visibility.Collapsed;
                _verticalRedLine.Visibility = Visibility.Collapsed;
                _verticalRedTwoLine.Visibility = Visibility.Collapsed;
                _verticalBlackLineNoRight.Visibility = Visibility.Visible;
            }

            ctrl.MyStroke = StrokeColor;
            ctrl.CurrentPage = CurrentPage;
            ctrl.InitialPacu(pdm, dsm, dsm2);
            CurrentLine = ctrl;
        }
        public void SingleDisplay(DrawDrugLineModel lineEnum, PatientDrugsModel pdm, DrugSpeedModel dsm)
        {
            BaseDrugLineItemCtrl ctrl = _verticalBlackLineNoRight;
            _arrowRedLine.Visibility = Visibility.Collapsed;
            _verticalBlackLine.Visibility = Visibility.Collapsed;
            _verticalBlackObliqueLine.Visibility = Visibility.Collapsed;
            _verticalRedLine.Visibility = Visibility.Collapsed;
            _verticalRedTwoLine.Visibility = Visibility.Collapsed;
            _verticalBlackLineNoRight.Visibility = Visibility.Visible;
            ctrl.CurrentPage = CurrentPage;
            ctrl.InitialSingle(pdm, dsm);
            CurrentLine = ctrl;
        }
        public void PacuSingleDisplay(DrawDrugLineModel lineEnum, PatientDrugsModel pdm, DrugSpeedModel dsm)
        {
            BaseDrugLineItemCtrl ctrl = _verticalBlackLineNoRight;
            _arrowRedLine.Visibility = Visibility.Collapsed;
            _verticalBlackLine.Visibility = Visibility.Collapsed;
            _verticalBlackObliqueLine.Visibility = Visibility.Collapsed;
            _verticalRedLine.Visibility = Visibility.Collapsed;
            _verticalRedTwoLine.Visibility = Visibility.Collapsed;
            _verticalBlackLineNoRight.Visibility = Visibility.Visible;
            ctrl.CurrentPage = CurrentPage;
            ctrl.InitialPacuSingle(pdm, dsm);
            CurrentLine = ctrl;
        }
        
        #endregion

        #region EventHandlers

        #endregion
    }

    public enum DrawDrugLineModel
    {
        VerticalArrowLine,
        VerticalBlackLine,
        VerticalBlackObliqueLine,
        VerticalLine,
        VerticalTwoLine,
        VerticalBlackLineNoRight
    }
}
